home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Programming / Programming Utilities / ViewIt Shareware / ViewIt™ 2.04 Shareware / Projects / Pascal Demos / vDemoLP.pas < prev    next >
Pascal/Delphi Source File  |  1992-08-04  |  4KB  |  137 lines

  1. {ViewIt 2.03 Demonstration Program}
  2. {©FaceWare 1991-92.  All Rights Reserved.}
  3.  
  4. program vDemoLP;
  5. {$I-}
  6.  
  7.     uses
  8.         FaceStorLP, FaceProcLP;
  9.  
  10.     var
  11.         helpShown: boolean;
  12.         myRec: record
  13.                 myInteger: integer;
  14.                 myReal: real;
  15.                 myString: string[99];
  16.                 myFlags: longint;
  17.             end;
  18.         theReal: real;
  19.  
  20.     procedure JumpIt (thePtr: Ptr);
  21.     inline
  22.         $2257, $2051, $4E90;
  23.  
  24.     procedure OverProc (thePtr: Ptr);
  25.         var
  26.             delta: real;
  27.             theArrow: ControlHandle;
  28.     begin
  29.         with fRec do
  30.             if (cResID = 1000) then        {Arrow Controls}
  31.                 begin
  32.                     if (uCommand = 8) then        {a mouse down message?}
  33.                         begin
  34.                             delta := 0.001 * (cMin - 2);
  35.                             theArrow := cControl;
  36.                             HiliteControl(theArrow, 1);
  37.                             while StillDown do
  38.                                 begin
  39.                                     myRec.myReal := myRec.myReal + delta;
  40.                                     FaceIt(nil, SetVal, 0, 0, 2, 2);
  41.                                     Delay(5, uI4);
  42.                                 end;
  43.                             HiliteControl(theArrow, 0);
  44.                             exit(OverProc);
  45.                         end;
  46.                 end
  47.             else                                {Editable Text Item}
  48.                 begin
  49.                     if (uCommand = 264) then    {a key down message?}
  50.                         if (uParam[1] = 32) then    {SPACE key pressed?}
  51.                             uParam[1] := 95;            {convert to UNDERLINE}
  52.                 end;
  53.         JumpIt(thePtr);                    {pass message to driver}
  54.     end;
  55.  
  56. begin
  57.     myRec.myInteger := 0;
  58.     myRec.myReal := 6.2;
  59.     myRec.myString := 'Hello';
  60.     myRec.myFlags := 10;
  61.     theReal := 6.0;
  62.  
  63. {Initialize FaceIt}
  64.     fRec.uName := 'vDemo.Rsrc';
  65.     FaceIt(nil, DoInit, 0, 0, 0, 0);
  66.  
  67. {Show ViewIt On-Line Help (if available)}
  68.     FaceIt(nil, HlpWnd, 0, 0, 10, 10);
  69.  
  70. {Open Modeless Window using FWND 1000}
  71.     FaceIt(nil, NewWnd, 1000, 1, 0, 0);
  72.  
  73.     with fRec do
  74.         repeat
  75.             FaceIt(nil, DoLoop, 0, 0, 0, 0);
  76. {Standard "About" Menu Item Selection}
  77.             if (uMenuID = 101) and (uMenuItem = 1) then
  78.                 begin
  79.                     uString := concat('Demonstration of the use of ViewIt', chr(13), 'windows in a FaceIt-based program.');
  80.                     FaceIt(nil, ShoStr, 3, 12, 1 + (409 * 65536), 0);
  81.                 end
  82. {Hit in Modeless Window's "Open Modal" Button}
  83.             else if (uMenuID = 1000) and (wcHit = 2) then
  84.                 begin
  85.                     FaceIt(nil, NewWnd, 1001, 0, 0, 0);        {Open Modal Window}
  86.                     repeat
  87.                         FaceIt(nil, MdlWnd, 1001, 0, 0, 0);        {Process Modal Events}
  88.                         if (wcHit = -1) then                            {Hit in Close Box}
  89.                             leave
  90.                         else if (wcHit = 1) then                    {Hit in "Open Nested" Button}
  91.                             begin                                                {Open Nested Modal}
  92.                                 FaceIt(nil, NewWnd, 1002, 0, 110, ord(@myRec));
  93.                                 FaceIt(nil, GetCtl, 1002, 0, 2, 3);            {Setup Override Examples}
  94.                                 FaceIt(nil, OvrCtl, ord(cControl), ord(@OverProc), 0, 0);
  95.                                 FaceIt(nil, GetCtl, 1002, 0, 2, 6);
  96.                                 FaceIt(nil, OvrCtl, ord(cControl), ord(@OverProc), 0, 0);
  97.                                 FaceIt(nil, GetCtl, 1002, 0, 2, 7);
  98.                                 FaceIt(nil, OvrCtl, ord(cControl), ord(@OverProc), 0, 0);
  99.                                 FaceIt(nil, SetVal, 1002, 0, 0, 0);            {Set Linked Values}
  100.                                 helpShown := false;
  101.                                 repeat
  102.                                     FaceIt(nil, MdlWnd, 1002, 0, 0, 0);        {Process Modal Events}
  103.                                     if (wvHit = 1) then                            {Hit in View #1}
  104.                                         if (wcHit = 1) then                        {Hit in "OK" Button}
  105.                                             leave
  106.                                         else if (wcHit = 2) then                    {Hit in "Show/Hide" Button}
  107.                                             if helpShown then
  108.                                                 begin
  109.                                                     FaceIt(nil, ShoCtl, 0, 0, -3, 2);            {Hide v3, Show v2}
  110.                                                     helpShown := false;
  111.                                                 end
  112.                                             else
  113.                                                 begin
  114.                                                     FaceIt(nil, ShoCtl, 0, 0, -2, 3);            {Hide v2, Show v3}
  115.                                                     helpShown := true;
  116.                                                 end;
  117.                                 until false;
  118.                                 FaceIt(nil, GetVal, 1002, 0, 0, 0);            {Get Linked Values}
  119.                                 FaceIt(nil, EndWnd, 1002, 0, 0, 0);        {Close Nested Modal}
  120.                             end;
  121.                     until false;
  122.                     FaceIt(nil, EndWnd, 1001, 0, 0, 0);            {Close Modal Window}
  123.                 end
  124. {Hit in Modeless Window's "Why ViewIt?" Button}
  125.             else if (uMenuID = 1000) and (wcHit = 3) then
  126.                 begin
  127.                     FaceIt(nil, NewWnd, 1003, 0, 0, ord(@theReal));
  128.                     FaceIt(nil, SetVal, 1003, 0, 0, 0);
  129.                     repeat
  130.                         FaceIt(nil, MdlWnd, 1003, 0, 0, 0);
  131.                     until (wcHit = 1);
  132.                     FaceIt(nil, GetVal, 1003, 0, 0, 0);
  133.                     FaceIt(nil, EndWnd, 1003, 0, 0, 0);
  134.                 end;
  135.         until false;
  136.  
  137. end.